//
//  LYDefinitionView.m
//  LYLiveApp
//
//  Created by QD on 16/11/22.
//  Copyright © 2016年 览益信息科技. All rights reserved.
//

#import "LYDefinitionView.h"

@interface LYDefinitionView ()
@property (weak, nonatomic) IBOutlet UIView *definiImgView;
@property (strong,nonatomic) NSNumber *definitionNub;

@end

@implementation LYDefinitionView

- (void)setViewType:(DefinitionViewType)viewType {

    _viewType = viewType;
    if (viewType == DefinitionViewMaxClear) {
        [self.changeDefiBtn setTitle:@"超清" forState:UIControlStateNormal];
        self.maxClearBtn.selected = YES;
        self.highClearBtn.selected = NO;
        self.normalClearBtn.selected = NO;
        self.originClearBtn.selected = NO;
    } else if (viewType  == DefinitionViewHighClear) {
        [self.changeDefiBtn setTitle:@"高清" forState:UIControlStateNormal];
        self.maxClearBtn.selected = NO;
        self.highClearBtn.selected = YES;
        self.normalClearBtn.selected = NO;
        self.originClearBtn.selected = NO;
    } else if (viewType == DefinitionViewNormalClear) {
        [self.changeDefiBtn setTitle:@"标清" forState:UIControlStateNormal];
        self.maxClearBtn.selected = NO;
        self.highClearBtn.selected = NO;
        self.normalClearBtn.selected = YES;
        self.originClearBtn.selected = NO;
    } else if (viewType == DefinitionViewOriginClear) {
        [self.changeDefiBtn setTitle:@"原画" forState:UIControlStateNormal];
        self.maxClearBtn.selected = NO;
        self.highClearBtn.selected = NO;
        self.normalClearBtn.selected = NO;
        self.originClearBtn.selected = YES;
    }
}

- (IBAction)changeDefinitionAction:(UIButton *)button {
   
//    if (!button.selected) {
//        self.height = 23;
//        button.selected = YES;
//    } else {
//        self.height = 141;
//        button.selected = NO;
//    }
    
    self.definiImgView.hidden = !self.definiImgView.hidden;
}

- (IBAction)originClearAction:(id)sender {
    
    self.definiImgView.hidden = YES;
    self.viewType = DefinitionViewOriginClear;
    if (self.definitionblock) {
        self.definitionblock(VHallMovieDefinitionOrigin);
    }
}

- (IBAction)maxClearAction:(id)sender {
    
    self.definiImgView.hidden = YES;
    self.viewType = DefinitionViewMaxClear;
    if (self.definitionblock) {
        self.definitionblock(VHallMovieDefinitionUHD);
    }
}

- (IBAction)highClearBth:(id)sender {
    
    self.definiImgView.hidden = YES;
    self.viewType = DefinitionViewHighClear;
    if (self.definitionblock) {
        self.definitionblock(VHallMovieDefinitionHD);
    }
}

- (IBAction)normalClearBth:(id)sender {
   
    self.definiImgView.hidden = YES;
    self.viewType = DefinitionViewNormalClear;
    if (self.definitionblock) {
        self.definitionblock(VHallMovieDefinitionSD);
    }
}

+ (instancetype)viewWithXib
{
    LYDefinitionView *view = [[[UINib nibWithNibName:@"LYDefinitionView" bundle:nil] instantiateWithOwner:self options:nil] lastObject];
    return view;
}

@end
